package com.bigfish.gbs.util;

import com.bigfish.gbs.dto.Result;
import com.bigfish.gbs.enums.ResultEnum;

/**
 * 封装处理Result对象的工具类
 * Created by Joycessh
 * 11/25/18 7:22 PM
 */
public class ResultUtil {

    /**
     * 方法说明
     * @author Joycessh
     * @param resultEnum
     * @return com.bigfish.gbs.dto.Result
     * @date 11/30/18 1:14 PM
     */
    public static  Result retFormat(ResultEnum resultEnum) {

        Result result = new Result();
        result.setCode(resultEnum.getCode());
        result.setMsg(resultEnum.getMsg());
        return result;
    }

    /**
     * success
     * @author Joycessh
     * @param
     * @return com.bigfish.gbs.dto.Result
     * @date 11/30/18 1:13 PM
     */
    public static Result success() {
        Result result =new Result();
        result.setCode(0);
        result.setMsg("成功");
        return result;
    }

    /**
     * success
     * @author Joycessh
     * @param code
	 * @param msg
     * @return com.bigfish.gbs.dto.Result
     * @date 11/30/18 1:13 PM
     */
    public static Result retParams(Integer code, String msg) {
        Result result =new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

}
